import url from '@/tool/index.js'
//教练列表
export const lists = (keyword="",page=1,cartype=1) => { 
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/coach/lists',
			data: {
				keyword:keyword,
				page:page,
				cartype:cartype,
				token: uni.getStorageSync('userToken')
			},
			header:{
				'Content-Type':'application/x-www-form-urlencoded'
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}
//教练详情
export const teacherDetail = (coachid) => { 
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/coach/detail',
			data: {
				coachid:coachid,
				token: uni.getStorageSync('userToken')
			},
			header:{
				'Content-Type':'application/x-www-form-urlencoded'
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}
//收藏教练
export const collectCoach = (coachid) => { 
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/coach/collectCoach',
			data: {
				coachid:coachid,
				token: uni.getStorageSync('userToken')
			},
			header:{
				'Content-Type':'application/x-www-form-urlencoded'
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}
